package com.atguigu.gmall.search.bean;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 、@JavaBean 使用注解声明bean es数据的映射信息
 * @author dyqstart
 * @create 2021-08-13-18:45
 * @since 1.0.0
 */
@Document(
        indexName = "gmall-person",
        createIndex = true,
        shards = 3,//分片
        replicas = 2//副本
)
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Person {

    @Id
    private Long id; // 主键字段

    @Field(type = FieldType.Keyword)
    private String name;

    @Field(type = FieldType.Text)
    private String address;

    @Field
    private Integer age;
}
